// import Vue from 'vue'
import App from './mobile/App.vue'
// import Home from './pages/home'
import Form from './mobile/form'
import Add from './mobile/form/form-add'
import Operation from './mobile/form/form-operation'
import Frame from './mobile/frame'
import { getI18n } from './services/lang'

const Vue = window.Vue
const VueRouter = window.VueRouter

Vue.config.productionTip = false

getI18n(window.appNameEn).then(res => {
  window.i18nLang = res && res.datas || {}
})

const routes = [{
  name: 'home',
  path: '/', component: App,
  children: [{
    path: `/subpage/:name`, component: Frame
  }, {
    path: '/form/:name', component: Form
  }]
},{
  name: 'form-add',
  path: '/form-add',
  component: Add
},{
  name: 'form-operation',
  path: '/form-operation',
  component: Operation
}]

// 3. 创建 router 实例，然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
  routes // (缩写) 相当于 routes: routes
})

const vm = new Vue({
  template: '<router-view></router-view>',
  router
}).$mount()

document.body.appendChild(vm.$el)
